home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Merciful 5
/
Merciful - Disc 5.iso
/
cdtools
/
fileshow.standalone
< prev
next >
Wrap
Text File
|
1995-10-23
|
17KB
|
586 lines
/* CD File READER V 1.0 1995 */
/* ------------------------------------------------------------- */
CDFileShowVersion="$VER: CDFileShow 1.0 (01-10-95)"
/* ------------------------------------------------------------- */
PORT=''
signal on syntax
options results
/* ------------------------------------------------------------- */
IF ~ SHOW('L', "rexxsupport.library") THEN DO
addlib("CDTools:rexxsupport.library",0,-30,0)
END
IF ~ SHOW('L', "rexxreqtools.library") THEN DO
addlib("CDTools:rexxreqtools.library",0,-30)
END
IF ~ SHOW('L', "rexxarplib.library") THEN DO
addlib("CDTools:rexxarplib.library",0,-30,0)
END
/* ------------------------------------------------------------- */
/*
Here we get the file name from the command line
*/
arg filename
/*
And then we extract the file extension
*/
ext=''
fname=''
if lastpos(".",filename)~==0 then ext=right(filename,length(filename)-lastpos(".",filename),lastpos(".",filename))
if lastpos("/",filename)~==0 then fname=right(filename,length(filename)-lastpos("/",filename),lastpos("/",filename))
if fname=='' then
do
if lastpos(":",filename)~==0 then fname=right(filename,length(filename)-lastpos(":",filename),lastpos(":",filename))
end
if fname=='' then
do
fname=filename
end
call Openfilelist
Showtext.v=""
/*
------------------------ Set font ----------------------------------
*/
/*
----------------------- Set up gadgets ---------------------------
*/
select
when ext="LHA" then Gadgets=Smalltitle||'|'||"COPY"||'|'||ext
when ext="LZX" then Gadgets=Smalltitle||'|'||"COPY"||'|'||ext
when ext="DMS" then Gadgets=SmallTitle||'|'||"COPY"||'|'||ext
when ext="LZH" then Gadgets=Smalltitle||'|'||"COPY"||'|'||ext
when ext="ZIP" then Gadgets=Smalltitle||'|'||"COPY"||'|'||ext
when filename=='READ.ME' then Gadgets=Smalltitle||'|'||"COPY"||'|'||READ
when ext="DOC" then Gadgets=Smalltitle||'|'||"COPY"||'|'||READ
when ext="TXT" then Gadgets=Smalltitle||'|'||"COPY"||'|'||READ
when ext="IFF" then Gadgets=Smalltitle||'|'||"COPY"||'|'||SHOW
when ext="GIF" then Gadgets=Smalltitle||'|'||"COPY"||'|'||SHOW
when ext="PIC" then Gadgets=Smalltitle||'|'||"COPY"||'|'||SHOW
when ext="JPG" then Gadgets=Smalltitle||'|'||"COPY"||'|'||SHOW
when ext="JPEG" then Gadgets=Smalltitle||'|'||"COPY"||'|'||SHOW
when ext="GUIDE" then Gadgets=Smalltitle||'|'||"COPY"||'|'||VIEW
otherwise Gadgets=Smalltitle||'|'||"COPY"||'|'||VIEW
end
/*
----------------------- Get and show ID.Diz ---------------------------
*/
call CheckAborting
SelectedFile=TCTC||filename||TCTC
if exists('T:FILE_ID.DIZ')then address command 'delete T:FILE_ID.DIZ quiet'
Showtext.v="No FILE_ID.DIZ"||newline||"For "filename
SELECT
WHEN ext='DMS' THEN ADDRESS command 'CDTools:dmsdescript > NIL: x T:FILE_ID.diz '||SelectedFile
WHEN ext='LHA' THEN ADDRESS command 'CDTools:lha x > NIL: '||SelectedFile||' FILE_ID.DIZ T:'
WHEN ext='LZX' THEN ADDRESS command 'CDTools:lzx x > NIL: '||SelectedFile||' FILE_ID.DIZ T:'
WHEN ext='LZH' THEN ADDRESS command 'CDTools:lha x > NIL: '||SelectedFile||' FILE_ID.DIZ T:'
WHEN ext='TXT' THEN ADDRESS command 'CDTools:TxtExtract e > NIL: T:FILE_ID.DIZ '||SelectedFile
WHEN ext='DOK' THEN ADDRESS command 'CDTools:TxtExtract e > NIL: T:FILE_ID.DIZ '||SelectedFile
WHEN ext='DOC' THEN ADDRESS command 'CDTools:TxtExtract e > NIL: T:FILE_ID.DIZ '||SelectedFile
WHEN ext='EXE' THEN ADDRESS command 'CDtools:EXEDescript x > NIL: T:FILE_ID.DIZ '||SelectedFile
WHEN ext='ZIP' THEN
do
olddirectory=pragma('D','T:')
ADDRESS command 'CDTools:Unzip > NIL: '||SelectedFile||'FILE_ID.DIZ '
pragma('D',olddirectory)
end
WHEN ext='GIF' THEN
do
olddirectory=pragma('D','T:')
ADDRESS command 'CDTools:Gifdesc e > NIL: '||SelectedFile||'FILE_ID.DIZ '
pragma('D',olddirectory)
end
OtherWise
END
if exists('T:FILE_ID.DIZ')then
do
Showtext.v=""
call open('FileID','T:FILE_ID.diz','r')
do until eof('FileID')
Showtext.v=Showtext.v||newline||readln('FileID')
end
call close('FileID')
end
/*
----------------------- Report selected file ---------------------------
*/
call writech CDFileShowWindow," "
call writech CDFileShowWindow,"Selected file -> "||filename
do t=length(filename)to 12
call writech CDFileShowWindow,' '
end
/*
----------------------- Perform operation ---------------------------
*/
call ChoiceWindow
exit
end
/* ------------------------------------------------------------- */
ChoiceWindow:
if ext="EXE"|ext="DOC"|ext="TXT"|ext="IFF"|ext="JPG"|ext="JPEG"|ext="GIF"|ext="PIC"|ext="GUIDE" then
call HandleImmediate
else do
fonttag = 'rt_font=topaz.font/8'
actieresult=rtezrequest(Showtext.v,Gadgets,"",fonttag TAG2,actieresult)
select
when actieresult=1 then call Nothing
when actieresult=2 then call Copying
when actieresult=0&ext="DMS" then call DMS
when actieresult=0&ext="LHA" then call LHA
when actieresult=0&ext="LZX" then call LZX
when actieresult=0&ext="LZH" then call LHA
when actieresult=0&ext="ZIP" then call ZIP
when actieresult=0&ext="DOC" then address command 'CDTools:PPMore '||filename
when actieresult=0&ext="DOK" then address command 'CDTools:PPMore '||filename
when actieresult=0&ext="TXT" then address command 'CDTools:PPMore '||filename
when actieresult=0&ext="IFF" then address command 'CDTools:VT '||filename
when actieresult=0&ext="GIF" then address command 'CDTools:VT '||filename
when actieresult=0&ext="PIC" then address command 'CDTools:VT '||filename
when actieresult=0&ext="JPG" then address command 'CDTools:VT '||filename
when actieresult=0&ext="JPEG" then address command 'CDTools:VT '||filename
when actieresult=0&ext="GUIDE" then address command 'CDTools:PPGuide '||filename
when actieresult=0 then call Other
end
end
return
/* ------------------------------------------------------------- */
HandleImmediate:
select
when ext="EXE" then address command 'run '||filename
when ext="DOC" then address command 'CDTools:PPMore '||filename
when ext="DOK" then address command 'CDTools:PPMore '||filename
when ext="TXT" then address command 'CDTools:PPMore '||filename
when ext="IFF" then address command 'CDTools:VT '||filename
when ext="GIF" then address command 'CDTools:VT '||filename
when ext="PIC" then address command 'CDTools:VT '||filename
when ext="JPG" then address command 'CDTools:VT '||filename
when ext="JPEG" then address command 'CDTools:VT '||filename
when ext="GUIDE" then address command 'CDTools:PPGuide '||filename
end
return
/* ------------------------------------------------------------- */
CheckAborting:
checkabort
if result=1 then do
beep
breakresult=rtezrequest("Exit Program ??","YES|NO","",TagL,breakresult)
if breakresult=1 then do
exit
end
end
return
/* ------------------------------------------------------------- */
OpenFilelist:
PubScr='WorkBench'
newline='a'x
TCTC='"'
Newshelltext="CON:100/60/440/61/CDFileShow/SCREEN"||PubScr
Outputtext=" <NIL: >"||TCTC||"CON:20/65/625/141/CDFileShow/SCREEN"||PubScr||TCTC
call open CDFileShowWindow,Newshelltext
if ~result then
do
say "Open failed .... !!!!"
exit
end
Tag0="rt_reqpos=reqpos_centerscr "
TagL="rt_reqpos=reqpos_topleftscr rt_leftoffset=460 rt_topoffset=11 "
TagR="rt_reqpos=reqpos_topleftscr rt_topoffset=11 "
Tag2=Tag0||"rt_pubscrname="||PubScr
Tag3=TagL||"rt_pubscrname="||PubScr
Tag4=TagR||"rt_pubscrname="||PubScr
SmallTitle=" SKIP"
return
/* ------------------------------------------------------------- */
syntax:
if rc<49 then ErrorText="Syntax Error" rc"," errortext(rc)"in line" sigl"."
if rc ~=2 then rtezrequest(Errortext,,"",Tag0)
say errortext
exit
/* ------------------------------------------------------------- */
SearchFilename:
Showtext.w="No FILE_ID.DIZ"
if SearchFile.w=list.z then
do
s=z+1
Showtext.w=newline
Showtext.w=Showtext.w||list.x||newline
end
return
/* ------------------------------------------------------------- */
Nothing:
call writeln CDFileShowWindow," >read file...ready<"
return
/* ------------------------------------------------------------- */
Skipping:
return
/* ------------------------------------------------------------- */
Copying:
call DirRequest
copytext="Copy "||filename||" to "||Directory||"....?"||newline
copyGadgets="COPY to "||Directory||"|"Smalltitle
copresult=rtezrequest(copytext,copyGadgets,"",Tag2,copresult)
if copresult=1 then
do
call writeln CDFileShowWindow," ->Copying to "||Directory
address command
'copy '||filename||' '||Directory
end
if copresult=0 then call writeln CDFileShowWindow," --Didn't Copy or Move anything"
return
/* ------------------------------------------------------------- */
DMS:
dmstext="Where do YOU want DMS to ?"||newline||SelectedFile
dmsGadgets="DF0|RAD|DF1|DF2|FF0|FF1|FF2|FF3|FF4|FF5|FF6|FF7|FF8|FF9|"Smalltitle
dmsresult=rtezrequest(dmstext,dmsGadgets,"",Tag2,dmsresult)
if dmsresult=1 then do
call writeln CDFileShowWindow," ->DMS to DF0:"
address command
'CDTools:dms write' SelectedFile "to DF0: NOTEXT NOVERIFY NOPAUSE"||Outputtext
end
if dmsresult=2 then do
call writeln CDFileShowWindow," ->DMS to RAD:"
address command
if SHOWLIST('H','RAD')
then call writeln CDFileShowWindow," RAD: already mounted"
else do
call writeln CDFileShowWindow," Mounting RAD:"
'mount RAD: from CDTools:FileShowRAD'
end
'CDTools:dms write' SelectedFile "to RAD: NOTEXT NOPAUSE"||Outputtext
ScanDirFlag="RAD:"
end
if dmsresult=3 then do
call writeln CDFileShowWindow," ->DMS to DF1:"
address command
'CDTools:dms write' SelectedFile "to DF1: NOTEXT NOVERIFY NOPAUSE"||Outputtext
end
if dmsresult=4 then do
call writeln CDFileShowWindow," ->DMS to DF2:"
address command
'CDTools:dms write' SelectedFile "to DF2: NOTEXT NOVERIFY NOPAUSE"||Outputtext
end
if dmsresult=5 then do
call writeln CDFileShowWindow," ->DMS to FF0:"
address command
if SHOWLIST('H','FF0')
then call writeln CDFileShowWindow," FF0: already mounted"
else do
call writeln CDFileShowWindow," Mounting FF0:"
'mount FF0: FROM CDTools:FileShowFF0'
end
'CDTools:dms write' SelectedFile "to FF0: NOTEXT NOVERIFY NOPAUSE"||Outputtext
ScanDirFlag="FF0:"
end
if dmsresult=6 then do
call writeln CDFileShowWindow," ->DMS to FF1:"
address command
if SHOWLIST('H','FF1')
then call writeln CDFileShowWindow," FF1: already mounted"
else do
call writeln CDFileShowWindow," Mounting FF1:"
'mount FF1: FROM CDTools:FileShowFF1'
end
'CDTools:dms write' SelectedFile "to FF1: NOTEXT NOVERIFY NOPAUSE"||Outputtext
ScanDirFlag="FF1:"
end
if dmsresult=7 then do
call writeln CDFileShowWindow," ->DMS to FF2:"
address command
if SHOWLIST('H','FF2')
then call writeln CDFileShowWindow," FF2: already mounted"
else do
call writeln CDFileShowWindow," Mounting FF2:"
'mount FF2: FROM CDTools:FileShowFF2'
end
'CDTools:dms write' SelectedFile "to FF2: NOTEXT NOVERIFY NOPAUSE"||Outputtext
ScanDirFlag="FF2:"
end
if dmsresult=8 then do
call writeln CDFileShowWindow," ->DMS to FF3:"
address command
if SHOWLIST('H','FF3')
then call writeln CDFileShowWindow," FF3: already mounted"
else do
call writeln CDFileShowWindow," Mounting FF3:"
'mount FF3: FROM CDTools:FileShowFF3'
end
'CDTools:dms write' SelectedFile "to FF3: NOTEXT NOVERIFY NOPAUSE"||Outputtext
ScanDirFlag="FF3:"
end
if dmsresult=9 then do
call writeln CDFileShowWindow," ->DMS to FF4:"
address command
if SHOWLIST('H','FF4')
then call writeln CDFileShowWindow," FF4: already mounted"
else do
call writeln CDFileShowWindow," Mounting FF4:"
'mount FF4: FROM CDTools:FileShowFF4'
end
'CDTools:dms write' SelectedFile "to FF4: NOTEXT NOVERIFY NOPAUSE"||Outputtext
ScanDirFlag="FF4:"
end
if dmsresult=10 then do
call writeln CDFileShowWindow," ->DMS to FF5:"
address command
if SHOWLIST('H','FF5')
then call writeln CDFileShowWindow," FF5: already mounted"
else do
call writeln CDFileShowWindow," Mounting FF5:"
'mount FF5: FROM CDTools:FileShowFF5'
end
'CDTools:dms write' SelectedFile "to FF5: NOTEXT NOVERIFY NOPAUSE"||Outputtext
ScanDirFlag="FF5:"
end
if dmsresult=11 then do
call writeln CDFileShowWindow," ->DMS to FF6:"
address command
if SHOWLIST('H','FF6')
then call writeln CDFileShowWindow," FF6: already mounted"
else do
call writeln CDFileShowWindow," Mounting FF6:"
'mount FF6: FROM CDTools:FileShowFF6'
end
'CDTools:dms write' SelectedFile "to FF6: NOTEXT NOVERIFY NOPAUSE"||Outputtext
ScanDirFlag="FF6:"
end
if dmsresult=12 then do
call writeln CDFileShowWindow," ->DMS to FF7:"
address command
if SHOWLIST('H','FF7')
then call writeln CDFileShowWindow," FF7: already mounted"
else do
call writeln CDFileShowWindow," Mounting FF7:"
'mount FF7: FROM CDTools:FileShowFF7'
end
'CDTools:dms write' SelectedFile "to FF7: NOTEXT NOVERIFY NOPAUSE"||Outputtext
ScanDirFlag="FF7:"
end
if dmsresult=13 then do
call writeln CDFileShowWindow," ->DMS to FF8:"
address command
if SHOWLIST('H','FF8')
then call writeln CDFileShowWindow," FF8: already mounted"
else do
call writeln CDFileShowWindow," Mounting FF8:"
'mount FF8: FROM CDTools:FileShowFF8'
end
'CDTools:dms write' SelectedFile "to FF8: NOTEXT NOVERIFY NOPAUSE"||Outputtext
ScanDirFlag="FF8:"
end
if dmsresult=14 then do
call writeln CDFileShowWindow," ->DMS to FF9:"
address command
if SHOWLIST('H','FF9')
then call writeln CDFileShowWindow," FF9: already mounted"
else do
call writeln CDFileShowWindow," Mounting FF9:"
'mount FF9: FROM CDTools:FileShowFF9'
end
'CDTools:dms write' SelectedFile "to FF9: NOTEXT NOVERIFY NOPAUSE"||Outputtext
ScanDirFlag="FF9:"
end
if dmsresult=0 then call writeln CDFileShowWindow," --Didn't Dms anything"
if rc ~=0 then do
call writeln CDFileShowWindow,"
DMS ERROR ->
"||result
end
return
/* ------------------------------------------------------------- */
LHA:
call DirRequest
lhatext="Extract "ext" "||newline||SelectedFile
lhaGadgets=ext||' to '||Directory"|"Smalltitle
lharesult=rtezrequest(lhatext,lhaGadgets,"",Tag2,lharesult)
if lharesult=1 then do
call writeln CDFileShowWindow," "||ext||" to "||Directory
address command
'CDtools:lha e '||SelectedFile||' '||Directory||' '||Outputtext
end
if lharesult=0 then call writeln CDFileShowWindow," --Didn't "ext" anything"
return
/* ------------------------------------------------------------- */
LZX:
call DirRequest
lzxtext="Extract "ext" "||newline||SelectedFile
lzxGadgets=ext||' to '||Directory"|"Smalltitle
lzxresult=rtezrequest(lzxtext,lzxGadgets,"",Tag2,lzxresult)
if lzxresult=1 then do
call writeln CDFileShowWindow," "||ext||" to "||Directory
address command
'CDtools:lzx -x x '||SelectedFile||' '||Directory||' '||Outputtext
end
if lzxresult=0 then call writeln CDFileShowWindow," --Didn't "ext" anything"
return
/* ------------------------------------------------------------- */
ZIP:
call DirRequest
ziptext="Extract "ext" "||newline||SelectedFile
zipGadgets=ext||' to '||Directory"|"Smalltitle
zipresult=rtezrequest(ziptext,zipGadgets,"",Tag2,zipresult)
if zipresult=1 then do
call writeln CDFileShowWindow," "||ext||" to "||Directory
address command
olddirectory=pragma('D','RAM:')
'CDtools:unzip '||SelectedFile||' '||Directory||' '||Outputtext
address
pragma('D',olddirectory)
ScanDirFlag="RAM:"
end
if zipresult=0 then call writeln CDFileShowWindow," --Didn't "ext" anything"
return
/* ------------------------------------------------------------- */
MySetFont:
myfont.Name = 'topaz.font'
myfont.Size = 8
myfont.XSize = 8
myfont.Style = 0
myfont.Flags = 0
myport.Name = address()
pig=SetFont(myport.Name,myfont.Name,myfont.Size,myfont.Style,myfont.Flags,myfont.XSize)
return
/* --------------------------------------------------------------*/
DirRequest:
Directory=TCTC||getfile(50,50,,,"Please select destination directory","Workbench",NOFILES)||TCTC
return
/* ------------------------------------------------------------- */
FileRequest:
File=TCTC||getfile(50,50,,,"Please select file")||TCTC
return
/* ------------------------------------------------------------- */
Other:
othertext="PLEASE SELECT:"||newline||SelectedFile
otherGadgets="READ IT|EXECUTE|"BACK
othresult=rtezrequest(othertext,otherGadgets,"",Tag2,othresult)
if othresult=1 then do
call writeln CDFileShowWindow," ->Read the file "
address command
'CDTools:PPMore '||filename
end
if othresult=2 then do
call writeln CDFileShowWindow," ->Executing the file "
address command
'execute '||filename
end
if othresult=0 then call writeln CDFileShowWindow," --Didn't know what to do with"
return
/* End --------------------------------------------------------- */